/**
 * 
 */
package niuke.jingdong;

/**
 * 给定棋盘，棋盘上有奖励，从左上角走到右下角，只能向右或者向下，能得到的最大奖励
 * 
 * @author zhongfang
 *
 */
public class 年终奖 {
	public int getMost(int[][] board) {
		int n = board.length;
		int m = board[0].length;
		int[][] dp = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				dp[i][j] = Math.max(i != 0 ? dp[i - 1][j] : 0, j != 0 ? dp[i][j - 1] : 0) + board[i][j];
			}
		}
		return dp[n - 1][m - 1];
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
